package com.woniuxy.educationplatform.service.impl;

import com.woniuxy.educationplatform.bean.LiveBean;
import com.woniuxy.educationplatform.mapper.LiveMapper;
import com.woniuxy.educationplatform.service.ILiveService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;

@Service
@Transactional(readOnly = true)
public class LiveServiceImpl implements ILiveService {

    @Resource
    private LiveMapper liveMapperImpl;
    @Override
    public List<LiveBean> findAll() {
        return liveMapperImpl.findAll();
    }

    @Transactional(isolation = Isolation.REPEATABLE_READ,rollbackFor = Exception.class)
    @Override
    public void saveLiveBean(LiveBean liveBean) {
        liveMapperImpl.saveLiveBean(liveBean);
    }

    @Override
    public List<LiveBean> findOneByCondition(LiveBean liveBean) {
        return liveMapperImpl.findOneByCondition(liveBean);
    }

    @Transactional(isolation = Isolation.REPEATABLE_READ,rollbackFor = Exception.class)
    @Override
    public void changeStatus(Long status,Long id) {
        liveMapperImpl.changeStatus(status,id);
    }

    @Transactional(isolation = Isolation.REPEATABLE_READ,rollbackFor = Exception.class)
    @Override
    public void delete(Long id) {
        liveMapperImpl.delete(id);
    }
}
